{% if page.paginator %}
  {% assign paginator = page.paginator %}
  {% assign category_path = page.title | append:'/' %}
{% endif %}

{% for cat in site.all_categories %}
  {% if page.title == cat[0] %}
    {% assign category_name = cat[1] %}
    {% assign category_link = cat[2] %}
  {% endif %}
{% endfor %}

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="description" content="{{ page.description }} - {{ site.name }}" />

    <title>栏目：{{ category_name }} - {{ site.name }}</title>
    <!-- Bootstrap Core CSS -->
    <link href="/css/bootstrap.min.css" rel="stylesheet"/>
    <!-- Custom CSS -->
    <link href="/css/blog.css" rel="stylesheet"/>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media
    queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file://
    -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
      </script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js">
      </script>
    <![endif]-->
        <!-- jQuery Version 1.11.0 -->
    <script src="/js/jquery-1.11.0.js"> </script>
    <!-- Bootstrap Core JavaScript -->
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/tongji.js"></script>
  </head>
  
  <body>
    <!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">
              Toggle navigation
            </span>
            <span class="icon-bar">
            </span>
            <span class="icon-bar">
            </span>
            <span class="icon-bar">
            </span>
          </button>
          <a class="navbar-brand" href="/">
            首页
          </a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          {% include navigation.html %} 
        </div>
        <!-- /.navbar-collapse -->
      </div>
      <!-- /.container -->
    </nav>
    <!-- Page Content -->
    <div class="container">
      <div class="row">
        <!-- Blog Entries Column -->
        <div class="col-md-8">
          <!-- Navi -->
          <div class="post_frame">
            <div class="post_navi">
              <a href="/">首页</a>&nbsp;>&nbsp;
              <a href="{{ catgory_link }}">{{ category_name }}</a>&nbsp;>&nbsp;
              <span class="post_navi_span">列表</span>
            </div>
            <div style="padding:10px">
<!-- Loop output paged posts -->

{% for post in paginator.posts %}
<h2>
  <a href="{{ post.url }}">
    {{ post.title }}
  </a> 
  <div class="post-date">
	<span class="glyphicon glyphicon-time"></span>
	{{ post.date | date:"%Y-%m-%d" }}
  </div>
</h2>
<hr>
{{ post.excerpt }}
	<p><h3><a href="{{ post.url }}">阅读全文 &raquo;</a></h3></p>
<hr>
{% endfor %}

<!-- Pager indicator -->
<div style="margin:0px auto;text-align: center">
{% if paginator.total_pages > 1 %}
<ul class="pagination">
  {% if paginator.previous_page %}
  <li>
    {% if paginator.previous_page >1 %} 
      {% assign appendix = '.html' %}
    {% else %}
      {% assign appendix = 'index.html' %}
    {% endif %}
    <a href="{{ category_path | append : paginator.previous_page_path | append : appendix| prepend: site.baseurl | replace: '//', '/' }}">&laquo; Prev</a>
  </li>
  {% else %}
  <li>
    <span>&laquo; Prev</span>
  </li>
  {% endif %}

  {% for page in (1..paginator.total_pages) %}
    {% if page == paginator.page %}
    <li class="active">
      <span>{{ page }}</span>
    </li>
    {% elsif page == 1 %}
    <li>
      <a href="{{ category_path | append : '/index.html' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a>
    </li>
    {% else %}
    <li>
      <a href="{{ category_path | append : site.paginate_path | append : '.html' | prepend: site.baseurl | replace: ':num', page }}">{{ page }}</a>
    </li>
    {% endif %}
  {% endfor %}

  {% if paginator.next_page %}
   <li>
    <a href="{{ category_path | append : paginator.next_page_path | append : '.html' | prepend: site.baseurl | replace: '//', '/' }}">Next &raquo;</a>
   </li>
  {% else %}
  <li>
    <span>Next &raquo;</span>
  </li>
  {% endif %}
</ul>
{% endif %}
</div>
            </div>
          </div>
        </div>
        <!-- Blog Sidebar Widgets Column -->
        <div class="col-md-4">
          <!-- Side Widget Well -->
          <div class="well">
            <h4>
              推荐链接
            </h4>
			      <div class="row">
            {% include recommend_link.html %} 
            </div>
          </div>

          <!-- Side Widget Well -->
          <div class="well-ad">
            {% include adsense_336x280.html %} 
          </div>

		     <!-- Blog Recent Well -->
          <div class="well">
            <h4>
              最新文章
            </h4>
            <div class="row">
                    {% include recent_posts.html %} 
            </div>
          </div>		  

        </div>
      </div>
      <!-- /.row -->

      <!-- Footer -->
      <footer>
        <div class="row">
          <div class="col-lg-12">
            {% include copyright.html %} 
          </div>
          <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
      </footer>
    </div>
    <!-- /.container -->
    {% include spider.html %} 
  </body>
</html>